package work;

import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;

import work.WorkDB;

public class WorkAvail extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException
	{
	
		String artigo = String.valueOf(request.getParameter("artigo"));
		String nota = String.valueOf(request.getParameter("nota"));
		
		if(WorkDB.avail(artigo, nota))
		{
			request.setAttribute("msg", "Sucesso");
			RequestDispatcher rdIndex = request.getRequestDispatcher("trabalhos_avaliacao.jsp");
			rdIndex.forward(request, response);
		}
		else
		{
			request.setAttribute("msg", "Erro");
			RequestDispatcher rdIndex = request.getRequestDispatcher("trabalhos_avaliacao.jsp");
			rdIndex.forward(request, response);
		}
		
	
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
	{
		// same logic
		this.doGet(request, response);
	}
}

